﻿using Microsoft.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;

namespace Himp.DataHub.EntityFrameworkCore;

[ConnectionStringName(DataHubDbProperties.ConnectionStringName)]
public class DataHubDbContext : AbpDbContext<DataHubDbContext>, IDataHubDbContext
{
    public DbSet<DiseaseDict> DiseaseDicts { get; set; }

    public DbSet<MatlsBasicInfo> MatlsBasicInfos { get; set; }

    public DbSet<DeptConsultRm> DeptOperRms { get; set; }

    #region 公共项目

    public DbSet<AgmtItem> AgmtItems { get; set; }

    public DbSet<PubItem> PubItems { get; set; }

    public DbSet<PubItemAssocBilgPerm> PubItemAssocBilgPerms { get; set; }

    public DbSet<PubItemAssocChrgitmType> PubItemAssocChrgitmTypes { get; set; }

    public DbSet<PubItemAssocExeDept> PubItemAssocExeDepts { get; set; }

    #endregion

    #region 科室

    /// <summary>
    /// 科室信息
    /// </summary>
    public DbSet<DeptInfo> DeptInfos { get; set; }

    /// <summary>
    /// 科室诊间
    /// </summary>
    public DbSet<DeptConsultRm> DeptConsultRms { get; set; }

    /// <summary>
    /// 科室病区
    /// </summary>
    public DbSet<DeptWard> DeptWards { get; set; }

    /// <summary>
    /// 科室对应属性
    /// </summary>
    public DbSet<DeptAttr> DeptAttrs { get; set; }

    #endregion

    public DataHubDbContext(DbContextOptions<DataHubDbContext> options)
        : base(options)
    {

    }

    protected override void OnModelCreating(ModelBuilder builder)
    {
        base.OnModelCreating(builder);

        builder.ConfigureDataHub();
    }
}
